package coroutines

import kotlinx.coroutines.*
import java.lang.ArithmeticException
import java.lang.AssertionError


fun main(){
    runBlocking {
        val handler = CoroutineExceptionHandler{_, exception->
            println("coroutinehandler got $exception")
        }
        val job = GlobalScope.launch(handler) {
            throw AssertionError()
        }
        val deferred = GlobalScope.async(handler) {
            throw ArithmeticException()
        }
        joinAll(job, deferred)
    }
}